#!D:/CODE/python
# -*- coding: utf-8 -*-
# @Time : 2020/5/23 21:52
# @Author : Alexdong
# @Site : 
# @File : 使用进程实现多任务.py
# @Software: PyCharm
# Functional description:

import time
import threading
import multiprocessing


# 进程比线程占用的资源要更多， 进程= 代码+资源（内存，摄像头，等等）

def test1():
    while True:
        print("1---")
        time.sleep(1)

def test2():
    while True:
        print("2---")
        time.sleep(1)

def main():
    # t1 = threading.Thread(target=test1)
    # t2 = threading.Thread(targe= test2)
    #
    # t1.start()
    # t2.start()
    p1 = multiprocessing.Process(target=test1)
    p2 = multiprocessing.Process(target=test2)
    p1.start()
    p2.start()


if __name__ =="__main__":
    main()